<template>
  <div>
    <el-select v-model="form.progress" :size="formSize" clearable placeholder="跟进状态" @change="onChange">
      <el-option v-for="item in statusList" :key="item.status" :label="item.desc" :value="item.status" />
    </el-select>
  </div>
</template>
<script>
import { GETCUSTOMERSTATUS } from "@/api/customer";
export default {
  name: "FollowStatus",
  data() {
    return {
      formSize: "small",
      form: {},
      statusList: this.$store.state.common.followStatus,
    };
  },
  mounted() {
    let o = this.$store.state.common;
    console.log(o)
    if (!o.followStatus || o.followStatus.length <= 0) {
      this.getStatus();
    }
  },
  methods: {
    // 获取状态
    getStatus() {
      GETCUSTOMERSTATUS().then((res) => {
        let list = res.data || [];
        this.statusList = list;
        this.$store.dispatch("common/setFollowStatus", list);
      });
    },

    // 监听标签选择
    onChange(e) {
      console.log(e);
      this.$emit("input", e);
    },
  },
};
</script>
<style lang="scss" scoped>
</style>